<?php
use_stylesheet('show.css');

use_helper('toolsbar');
slot('Toolsbar');
   echo setToolbar('show','client',$client);
end_slot();

slot('PageTitle',$client->getName());
slot('Title',$client->getName());
?>

<table id="show">
  <tbody>
    <tr>
      <th>Name:</th>
      <td colspan="3"><?php echo $client->getName() ?></td>
    </tr>
    
    <tr>
      <th> Belonging Plants: </th>
      <td>
      <?php foreach ($plants=$client->getPlant() as $plant): ?>
      <a href="<?php echo url_for('plant_show',$plant)?>"> <?php echo $plant->getName() ?></a>
      &nbsp;
      <?php endforeach?>
      </td>
    </tr>
   <tr>
      <th>Ref1: </th>
      <td><a href="<?php echo url_for('contact_show',$client->getContact()) ?>"><?php echo $client->getContact() ?></td> 
      <td> &nbsp; - Phone: <?php if (!is_null($client->getContact()->getphone1())) echo $client->getContact()->getPhone1(); else echo "-"?> </td>
      <td> &nbsp; - Mail: <?php if (!is_null($client->getContact()->getMail1())) echo $client->getContact()->getMail1(); else echo "-"?> </td>
    </tr>    
    <tr>
      <th>Ref2: </th>
      <td><a href="<?php echo url_for('contact_show',$client->getContact_2()) ?>"><?php echo $client->getContact_2() ?></td> 
    <?php if (!is_null($client->getContact_2()->getName())): ?>
      <td> &nbsp; - Phone: <?php if (!is_null($client->getContact_2()->getphone1())) echo $client->getContact_2()->getPhone1(); else echo "-"?> </td>
      <td> &nbsp; - Mail: <?php if (!is_null($client->getContact_2()->getMail1())) echo $client->getContact_2()->getMail1(); else echo "-"?> </td>
    <?php endif;?>
    </tr>
    <tr>
      <th>Ref3: </th>
      <td><a href="<?php echo url_for('contact_show',$client->getContact_3()) ?>"><?php echo $client->getContact_3() ?></td>
    <?php if (!is_null($client->getContact_3()->getName())): ?>
      <td> &nbsp; - Phone: <?php if (!is_null($client->getContact_3()->getphone1())) echo $client->getContact_3()->getPhone1(); else echo "-"?> </td>
      <td> &nbsp; - Mail: <?php if (!is_null($client->getContact_3()->getMail1())) echo $client->getContact_3()->getMail1(); else echo "-"?> </td>
    <?php endif; ?>
    </tr>
    <tr>
      <th>Note:</th>
      <td colspan="3"><?php echo $client->getNote() ?></td>
    </tr>
    <tr>
      <th>Address:</th>
      <td colspan="3"><?php echo $client->getAddress() ?></td>
    </tr>
  </tbody>
</table>
